package com.example.lastwork.dao;


import com.example.lastwork.common.dao.LogicDAO;
import com.example.lastwork.entity.Business;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface BusinessDao extends LogicDAO<Business, Long> {
    @Modifying
    @Query("UPDATE Orders o SET o.status = 2 WHERE o.id = :ordersId AND o.status = 1")
    int confirmOrder(@Param(value = "ordersId") Long ordersId);

    @Modifying
    @Query("UPDATE Orders o SET o.status = 3 WHERE o.id = :ordersId AND o.status = 2")
    int refundOrder(@Param(value = "ordersId") Long ordersId);
}
